<template>
  <div class="login-page-wrapper">
    <div class="login-container">
      <!-- 左侧信息区 -->
      <div class="login-info-section" :class="{ 'slide-right': isRegister || isForgotPassword }">
        <div class="login-info-content">
          <div class="logo-container">
            <img src="@/assets/img/logo.png" alt="Logo" class="logo-image" />
            <h1 class="system-title">{{ SYSYTM_TITLE }}</h1>
          </div>
          <div class="info-description">
            <h2>{{ isRegister ? '欢迎加入我们' : isForgotPassword ? '找回密码' : '欢迎回来' }}</h2>
            <p>{{ isRegister ? '创建账号，开启你的创新创业之旅' : isForgotPassword ? '重置您的密码，继续创新创业之旅' : '登录你的账号，继续你的创新创业之旅' }}</p>
          </div>

          <div class="info-action">
            <a-button v-if="isRegister" type="primary" ghost size="large" @click="toggleMode(1)">
              已有账号？去登录
            </a-button>
            <a-button v-else-if="isForgotPassword" type="primary" ghost size="large" @click="toggleMode(1)">
              返回登录
            </a-button>
            <a-button v-else type="primary" ghost size="large" @click="toggleMode(2)" style="color: #fff;">
              没有账号？去注册
            </a-button>
          </div>
        </div>
      </div>

      <!-- 右侧表单区 -->
      <div class="login-form-section" :class="{ 'slide-left': isRegister || isForgotPassword }">
        <div class="form-container">
          <div class="form-header">
            <h2>{{ isRegister ? '注册账号' : isForgotPassword ? '找回密码' : '账号登录' }}</h2>
            <p>{{ isRegister ? '请填写以下信息创建您的账号' : isForgotPassword ? '输入电子邮箱重置密码' : '请输入您的账号和密码' }}</p>
          </div>

          <!-- 用户类型选择 -->
          <div class="user-type-selector">
            <a-radio-group v-model:value="loginDataType" button-style="solid" class="user-type-radio">
              <a-radio-button :value="1">比赛成员</a-radio-button>
              <a-radio-button :value="2">指导教师</a-radio-button>
            </a-radio-group>
          </div>

          <!-- 登录表单 -->
          <a-form v-if="!isRegister && !isForgotPassword" :model="loginForm" :rules="loginRules" @finish="handleLogin"
            layout="vertical" class="login-form">

            <!-- <a-form-item name="email" label="邮箱">
              <a-input v-model:value="loginForm.email" size="large" placeholder="请输入邮箱">
                <template #prefix><user-outlined /></template>
</a-input>
</a-form-item> -->

            <a-form-item name="loginValue" label="学号/邮箱">
              <a-input v-model:value="loginForm.loginValue" size="large" placeholder="请输入学号或邮箱">
                <template #prefix><user-outlined /></template>
              </a-input>
            </a-form-item>

            <a-form-item v-if="loginType === 1" name="passWord" label="密码">
              <a-input-password v-model:value="loginForm.passWord" size="large" placeholder="请输入密码">
                <template #prefix><lock-outlined /></template>
              </a-input-password>
            </a-form-item>

            <a-form-item v-if="loginType === 2" name="code" label="验证码">
              <a-row :gutter="16">
                <a-col :span="16">
                  <a-input v-model:value="loginForm.code" size="large" placeholder="请输入验证码">
                    <template #prefix><safety-outlined /></template>
                  </a-input>
                </a-col>
                <a-col :span="8">
                  <a-button :disabled="countdown > 0" @click="sendCode" class="verify-code-btn" size="large" block>
                    {{ countdown > 0 ? `${countdown}秒` : '获取验证码' }}
                  </a-button>
                </a-col>
              </a-row>
            </a-form-item>

            <a-form-item name="isTeacher" hidden>
              <a-input v-model:value="loginForm.isTeacher" />
            </a-form-item>

            <div class="form-options">
              <a-checkbox v-model:checked="loginForm.remember">记住我</a-checkbox>
              <div class="login-options">
                <a class="login-type-link" @click="toggleLoginType">{{ loginType === 1 ? '验证码登录' : '密码登录' }}</a>
                <a-divider type="vertical" />
                <a class="forgot-link" @click="toggleMode(3)">忘记密码？</a>
              </div>
            </div>

            <a-form-item>
              <a-button type="primary" html-type="submit" size="large" block :loading="loading">
                登录
              </a-button>
            </a-form-item>

            <!-- <div class="other-login">
              <div class="other-login-title">其他登录方式</div>
              <div class="other-login-methods">
                <a-button shape="circle" class="other-login-btn">
                  <template #icon><wechat-outlined /></template>
                </a-button>
                <a-button shape="circle" class="other-login-btn">
                  <template #icon><qq-outlined /></template>
                </a-button>
                <a-button shape="circle" class="other-login-btn">
                  <template #icon><dingtalk-outlined /></template>
                </a-button>
              </div>
            </div> -->
          </a-form>

          <!-- 注册表单 -->
          <a-form v-else-if="isRegister" :model="registerForm" :rules="registerRules" @finish="handleRegister"
            layout="vertical" class="register-form">
            <div class="register-form-row">
              <a-form-item name="name" label="用户名" class="register-form-item">
                <a-input v-model:value="registerForm.name" size="large" placeholder="请输入真实姓名">
                  <template #prefix><user-outlined /></template>
                </a-input>
              </a-form-item>

              <a-form-item name="number" label="学号/工号" class="register-form-item">
                <a-input v-model:value="registerForm.number" size="large" placeholder="请输入学号/工号">
                  <template #prefix><number-outlined /></template>
                </a-input>
              </a-form-item>
            </div>

            <a-form-item name="college" label="学院" :rules="{ required: true, message: '请选择所在学院', trigger: 'change' }">
              <college-selector v-model="registerForm.college" placeholder="请选择所在学院" />
            </a-form-item>

            <a-form-item name="email" label="邮箱">
              <a-input v-model:value="registerForm.email" size="large" placeholder="请输入邮箱">
                <template #prefix><mail-outlined /></template>
              </a-input>
            </a-form-item>

            <a-form-item name="password" label="密码">
              <a-input-password v-model:value="registerForm.password" size="large" placeholder="请设置密码">
                <template #prefix><lock-outlined /></template>
              </a-input-password>
            </a-form-item>

            <a-row :gutter="16">
              <a-col :span="16">
                <a-form-item name="code" label="验证码">
                  <a-input v-model:value="registerForm.code" size="large" placeholder="请输入验证码">
                    <template #prefix><safety-outlined /></template>
                  </a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label=" " :colon="false">
                  <a-button size="large" block :disabled="countdown > 0" @click="sendRegisterCode"
                    class="verify-code-btn">
                    {{ countdown > 0 ? `${countdown}秒` : '获取验证码' }}
                  </a-button>
                </a-form-item>
              </a-col>
            </a-row>

            <a-form-item name="isTeacher" hidden>
              <a-input v-model:value="registerForm.isTeacher" />
            </a-form-item>

            <a-form-item>
              <a-button type="primary" html-type="submit" size="large" block :loading="loading"
                class="register-submit-btn">
                注册
              </a-button>
            </a-form-item>
          </a-form>

          <!-- 找回密码表单 -->
          <a-form v-else :model="forgotPasswordForm" :rules="forgotPasswordRules" @finish="handleForgotPassword"
            layout="vertical" class="forgot-password-form">
            <a-form-item name="email" label="邮箱">
              <a-input v-model:value="forgotPasswordForm.email" size="large" placeholder="请输入您的注册邮箱">
                <template #prefix><mail-outlined /></template>
              </a-input>
            </a-form-item>

            <a-row :gutter="16">
              <a-col :span="16">
                <a-form-item name="code" label="验证码">
                  <a-input v-model:value="forgotPasswordForm.code" size="large" placeholder="请输入验证码">
                    <template #prefix><safety-outlined /></template>
                  </a-input>
                </a-form-item>
              </a-col>
              <a-col :span="8">
                <a-form-item label=" " :colon="false">
                  <a-button size="large" block :disabled="countdown > 0" @click="sendForgotPasswordCode"
                    class="verify-code-btn">
                    {{ countdown > 0 ? `${countdown}秒` : '获取验证码' }}
                  </a-button>
                </a-form-item>
              </a-col>
            </a-row>

            <a-form-item name="newPassword" label="新密码">
              <a-input-password v-model:value="forgotPasswordForm.newPassword" size="large" placeholder="请设置新密码">
                <template #prefix><lock-outlined /></template>
              </a-input-password>
            </a-form-item>

            <a-form-item name="checkPassword" label="确认新密码">
              <a-input-password v-model:value="forgotPasswordForm.checkPassword" size="large" placeholder="请确认新密码">
                <template #prefix><lock-outlined /></template>
              </a-input-password>
            </a-form-item>

            <a-form-item name="isTeacher" hidden>
              <a-input v-model:value="forgotPasswordForm.isTeacher" />
            </a-form-item>

            <a-form-item>
              <a-button type="primary" html-type="submit" size="large" block :loading="loading"
                class="register-submit-btn">
                重置密码
              </a-button>
            </a-form-item>
          </a-form>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, reactive, watch } from 'vue';
import { message } from 'ant-design-vue';
import {
  UserOutlined, LockOutlined, MailOutlined, SafetyOutlined,
  WechatOutlined, QqOutlined, DingtalkOutlined, NumberOutlined
} from '@ant-design/icons-vue';
import { SYSYTM_TITLE } from '@/config';
import { TOKEN_KEY } from '@/config/cacheKey';
import { login_api, register_api, send_email, findPassword_api } from '@/apis';
import { useUserStore } from '@/store/user';
import { useRouter } from 'vue-router';
import CollegeSelector from '@/components/CollegeSelector.vue';

useSeoMeta({
  title: "登录注册-" + SYSYTM_TITLE,
  description: SYSYTM_TITLE,
  keywords: "白云学院,创新创业网",
  robots: "index, follow",
  canonical: "https://example.com",
});
definePageMeta({
  layout: 'login'
});

// 路由
const router = useRouter();

// 状态控制
const isRegister = ref(false);
const isForgotPassword = ref(false);
const loginType = ref(1);
const loginDataType = ref(1);
const loading = ref(false);
const countdown = ref(0);

// 用户存储
const user = useUserStore();

// 登录表单
const loginForm = reactive({
  loginValue: '',
  email: '',
  number: '',
  passWord: '',
  code: '',
  isTeacher: 0,
  remember: false
});

// 注册表单
const registerForm = reactive({
  name: '',
  number: '',
  college: '',
  email: '',
  password: '',
  code: '',
  isTeacher: 0
});

// 忘记密码表单
const forgotPasswordForm = reactive({
  email: '',
  code: '',
  newPassword: '',
  checkPassword: '',
  isTeacher: 0
});

// 监听用户类型变化，更新各表单中的isTeacher值
watch(loginDataType, (newVal) => {
  loginForm.isTeacher = newVal === 1 ? 0 : 1;
  registerForm.isTeacher = newVal === 1 ? 0 : 1;
  forgotPasswordForm.isTeacher = newVal === 1 ? 0 : 1;
});

//判断用户输入的是学号还是邮箱
const validateLoginValue = (rule, value) => {
  return new Promise((resolve, reject) => {
    if (value.includes('@')) {
      const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
      if (!emailRegex.test(value)) {
        reject(new Error('请输入正确的邮箱格式'));
      } else {
        loginForm.email = value;
        resolve();
      }
    } else {
      const studentIdRegex = /^\d+$/;
      if (!studentIdRegex.test(value)) {
        reject(new Error('请输入正确的学号格式'));
      } else {
        loginForm.number = value;
        resolve();
      }
    }
  });
};

// 表单验证规则
const loginRules = {
  // email: [
  //   { required: true, message: '请输入邮箱', trigger: 'blur' },
  //   { min: 3, message: '邮箱长度不能小于3个字符', trigger: 'blur' }
  // ],
  loginValue: [
    { required: true, message: '请输入学号或邮箱', trigger: 'blur' },
    { validator: validateLoginValue, trigger: 'blur' }
  ],
  passWord: [
    { required: true, message: '请输入密码', trigger: 'blur' },
    { min: 6, message: '密码长度不能小于6个字符', trigger: 'blur' }
  ],
  code: [
    { required: true, message: '请输入验证码', trigger: 'blur' }
  ],
  isTeacher: [
    { required: true, message: '请选择用户类型', trigger: 'change' }
  ]
};

const registerRules = {
  name: [
    { required: true, message: '请输入真实姓名', trigger: 'blur' }
  ],
  number: [
    { required: true, message: '请输入学号/工号', trigger: 'blur' }
  ],
  email: [
    { required: true, message: '请输入邮箱', trigger: 'blur' },
    { type: 'email', message: '请输入正确的邮箱格式', trigger: 'blur' }
  ],
  password: [
    { required: true, message: '请设置密码', trigger: 'blur' },
    { min: 6, message: '密码长度不能小于6个字符', trigger: 'blur' }
  ],
  code: [
    { required: true, message: '请输入验证码', trigger: 'blur' }
  ]
};

const forgotPasswordRules = {
  email: [
    { required: true, message: '请输入注册邮箱', trigger: 'blur' },
    { type: 'email', message: '请输入正确的邮箱格式', trigger: 'blur' }
  ],
  code: [
    { required: true, message: '请输入验证码', trigger: 'blur' }
  ],
  newPassword: [
    { required: true, message: '请设置新密码', trigger: 'blur' },
    { min: 6, message: '密码长度不能小于6个字符', trigger: 'blur' },
    {
      validator: (rule, value, callback) => {
        if (value && forgotPasswordForm.checkPassword && value !== forgotPasswordForm.checkPassword) {
          callback(new Error('两次密码不一致'));
        } else {
          callback();
        }
      },
      trigger: 'change'
    }
  ],
  checkPassword: [
    { required: true, message: '请确认新密码', trigger: 'blur' },
    {
      validator: (rule, value, callback) => {
        if (value && value !== forgotPasswordForm.newPassword) {
          callback(new Error('两次密码不一致'));
        } else {
          callback();
        }
      },
      trigger: 'blur'
    }
  ]
};



// 切换登录/注册/找回密码模式
const toggleMode = (mode) => {
  if (mode === 1) {
    isRegister.value = false;
    isForgotPassword.value = false;
  } else if (mode === 2) {
    isRegister.value = true;
    isForgotPassword.value = false;
  } else if (mode === 3) {
    isRegister.value = false;
    isForgotPassword.value = true;
  }
};

// 切换登录类型（密码/验证码）
const toggleLoginType = () => {
  loginType.value = loginType.value === 1 ? 2 : 1;
};

// 登录处理
const handleLogin = async (values) => {

  try {
    loading.value = true;
    let params = {};
    // const params = {
    //   email: values.email,
    //   isTeacher: loginForm.isTeacher
    // };

    if (values.loginValue.includes('@')) {
      // 使用邮箱登录
      params = {
        email: values.loginValue,
        password: values.passWord,
        isTeacher: loginForm.isTeacher
      };
    } else {
      // 使用学号登录
      params = {
        number: values.loginValue,
        password: values.passWord,
        isTeacher: loginForm.isTeacher
      };
    }

    if (loginType.value === 1) {
      params.passWord = values.passWord;
    } else {
      params.code = values.code;
    }

    const res = await login_api(params);

    if (res.code === 200) {
      setStore(TOKEN_KEY, res.data);

      if (loginForm.remember) {
        setStore('USER_EMAIL', values.email, { expires: 7 });
      }

      user.setUser();
      message.success('登录成功!');
      router.push('/ss');
    } else {
      message.error(res.msg || '登录失败，请检查账号和密码');
    }
  } catch (error) {
    console.error('登录失败:', error);
    message.error('登录失败，请稍后重试');
  } finally {
    loading.value = false;
  }
};


const handleRegister = async (values) => {
  try {
    loading.value = true;

    const res = await register_api({
      name: values.name,
      number: values.number,
      email: values.email,
      password: values.password,
      code: values.code,
      isTeacher: registerForm.isTeacher
    });

    if (res.code === 200) {
      message.success('注册成功!请登录');
      toggleMode(1); // 返回登录界面
    } else {
      message.error(res.msg || '注册失败，请稍后重试');
    }
  } catch (error) {
    console.error('注册失败:', error);
    message.error('注册失败，请稍后重试');
  } finally {
    loading.value = false;
  }
};

// 找回密码处理
const handleForgotPassword = async (values) => {
  try {
    loading.value = true;

    if (values.newPassword !== values.checkPassword) {
      message.error('两次密码不一致');
      return;
    }

    const res = await findPassword_api({
      email: values.email,
      code: values.code,
      newPassword: values.newPassword,
      checkPassword: values.checkPassword,
      isTeacher: forgotPasswordForm.isTeacher
    });

    if (res.code === 200) {
      message.success('密码已重置成功！');
      toggleMode(1); // 返回登录界面
    } else {
      message.error(res.msg || '密码重置失败，请稍后重试');
    }
  } catch (error) {
    console.error('密码重置失败:', error);
    message.error('密码重置失败，请稍后重试');
  } finally {
    loading.value = false;
  }
};

// 发送验证码通用方法
const sendVerificationCode = async (email) => {
  if (!email) {
    message.error('请输入邮箱');
    return;
  }

  try {
    loading.value = true;
    const res = await send_email(email);

    if (res.code === 200) {
      message.success('验证码已发送，请查收');
      // 设置倒计时
      countdown.value = 60;
      const intervalId = setInterval(() => {
        if (countdown.value > 0) {
          countdown.value--;
        } else {
          clearInterval(intervalId);
        }
      }, 1000);
    } else {
      message.error(res.msg || '验证码发送失败，请稍后重试');
    }
  } catch (error) {
    console.error('验证码发送失败:', error);
    message.error('验证码发送失败，请稍后重试');
  } finally {
    loading.value = false;
  }
};

// 登录验证码
const sendCode = () => {
  sendVerificationCode(loginForm.email);
};

// 注册验证码
const sendRegisterCode = () => {
  sendVerificationCode(registerForm.email);
};

// 找回密码验证码
const sendForgotPasswordCode = () => {
  sendVerificationCode(forgotPasswordForm.email);
};
</script>

<style lang="less" scoped>
.login-page-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-container {
  width: 900px;
  height: 700px;
  display: flex;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.1);
  background-color: white;
  position: relative;
  z-index: 1;

  &::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(147, 197, 253, 0.3) 0%, rgba(147, 197, 253, 0) 70%);
    z-index: -1;
    border-radius: 50%;
  }

  &::after {
    content: '';
    position: absolute;
    bottom: -50px;
    left: -50px;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(167, 139, 250, 0.3) 0%, rgba(167, 139, 250, 0) 70%);
    z-index: -1;
    border-radius: 50%;
  }

  @media (max-width: 768px) {
    flex-direction: column;
    height: auto;
    width: 95%;
    max-width: 500px;
  }
}


.login-info-section {
  width: 40%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  position: relative;
  transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,%3Csvg width="52" height="26" viewBox="0 0 52 26" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%23ffffff" fill-opacity="0.1"%3E%3Cpath d="M10 10c0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6h2c0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6 0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6 0 2.21 1.79 4 4 4v2c-3.314 0-6-2.686-6-6 0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6zm25.464-1.95l8.486 8.486-1.414 1.414-8.486-8.486 1.414-1.414z" /%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
    opacity: 0.25;
  }

  &.slide-right {
    transform: translateX(150%);
  }

  @media (max-width: 768px) {
    width: 100%;
    display: flex;
    flex-direction: column;
  }
}

.login-info-content {

  text-align: center;
  position: relative;
  z-index: 1;

  .logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;

    .logo-image {
      width: 40px;
      height: 40px;
      margin-right: 12px;
      filter: brightness(0) invert(1);
    }

    .system-title {
      font-size: 22px;
      font-weight: 600;
      margin: 0;
      letter-spacing: 0.5px;
      text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
  }

  .info-description {
    margin-bottom: 30px;

    h2 {
      font-size: 28px;
      margin-bottom: 12px;
      font-weight: 700;
      color: white;
      text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    p {
      font-size: 15px;
      opacity: 0.95;
      line-height: 1.6;
      padding: 0 20px;
    }
  }





  .info-action {
    padding: 10px 0;

    :where(.css-dev-only-do-not-override-352jjw).ant-btn-primary.ant-btn-background-ghost {
      color: white;

    }


  }
}


.login-form-section {
  width: 60%;
  background-color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);

  &.slide-left {
    transform: translateX(-66.67%);
  }

  @media (max-width: 768px) {
    width: 100%;
    transform: none !important;
  }
}

.form-container {
  width: 100%;
  max-width: 420px;
  padding: 30px 20px;

  .form-header {
    text-align: center;

    h2 {
      font-size: 26px;
      color: #333;
      margin-bottom: 8px;
      font-weight: 600;
      position: relative;

      &::after {
        content: '';
        display: block;
        width: 40px;
        height: 3px;
        background: linear-gradient(90deg, #667eea, #764ba2);
        margin: 8px auto 0;
        border-radius: 3px;
      }
    }

    p {
      color: #666;
      font-size: 15px;
      margin: 0;
    }
  }

  .form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;

    .login-options {
      display: flex;
      align-items: center;

      .login-type-link,
      .forgot-link {
        color: #4f46e5;
        cursor: pointer;
        font-size: 14px;

        &:hover {
          text-decoration: underline;
        }
      }
    }
  }

  .other-login {
    margin-top: 30px;
    text-align: center;

    .other-login-title {
      color: #999;
      margin-bottom: 16px;
      position: relative;
      font-size: 14px;

      &::before,
      &::after {
        content: '';
        position: absolute;
        top: 50%;
        width: 30%;
        height: 1px;
        background-color: #e5e7eb;
      }

      &::before {
        left: 0;
      }

      &::after {
        right: 0;
      }
    }

    .other-login-methods {
      display: flex;
      justify-content: center;
      gap: 20px;

      .other-login-btn {
        font-size: 20px;
        color: #666;
        background-color: #f5f5f5;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        transition: all 0.3s;

        &:hover {
          color: #4f46e5;
          background-color: #f0f0ff;
          transform: translateY(-2px);
          box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
      }
    }
  }
}

.register-form {

  .register-form-row {
    display: flex;
    gap: 16px;

    .register-form-item {
      flex: 1;
    }
  }

  .register-submit-btn {
    margin-top: 10px;
  }

  :deep(.ant-radio-button-wrapper) {
    padding: 0 15px;
    height: 32px;
    line-height: 30px;
  }

  .verify-code-btn {
    font-size: 13px;
  }
}

.login-form,
.register-form {
  transition: all 0.3s;
}

:deep(.ant-input-affix-wrapper) {
  padding: 8px 11px;
  transition: all 0.3s;

  &:hover,
  &:focus {
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
    border-color: #818cf8;
  }
}

:deep(.ant-form-item-label > label) {
  font-weight: 500;
  color: #4b5563;
}

:deep(.ant-btn-primary) {
  background: linear-gradient(90deg, #667eea, #764ba2);
  border: none;
  height: 40px;
  font-weight: 600;

  &:hover {
    background: linear-gradient(90deg, #764ba2, #667eea);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }
}

// 移动端
@media (max-width: 768px) {
  .login-container {
    flex-direction: column;
    height: auto;
    width: 95%;
    max-width: 500px;

    .login-info-section {
      display: flex;
      flex-direction: column;
      width: 100%;
      padding: 20px 0;
      transition: none; // 禁用动画效果
      transform: none !important; // 防止transform位移



      .login-info-content {
        display: flex;
        flex-direction: column;

        .logo-container {
          display: none;
        }

        .info-description {
          display: block;
          text-align: center;
          margin-bottom: 15px;

          h2 {
            font-size: 20px;
            margin-bottom: 8px;
          }

          p {
            font-size: 14px;
            padding: 0 15px;
          }
        }

        .info-action {
          display: flex;
          justify-content: center;
          margin-top: 0;
          padding: 10px 0;

          .ant-btn {
            min-width: 160px;
          }
        }
      }
    }


  }
}


.user-type-selector {
  margin: 12px 0;
  display: flex;
  justify-content: center;

  .user-type-radio {
    width: 100%;
    display: flex;

    :deep(.ant-radio-button-wrapper) {
      flex: 1;
      height: 40px;
      line-height: 38px;
      text-align: center;
      font-size: 14px;
      transition: all 0.3s ease;
      box-shadow: none;

      &:first-child {
        border-radius: 6px 0 0 6px;
      }

      &:last-child {
        border-radius: 0 6px 6px 0;
      }

      &:not(.ant-radio-button-wrapper-checked):hover {
        color: #667eea;
        background-color: rgba(102, 126, 234, 0.05);
      }

      &.ant-radio-button-wrapper-checked {
        color: white;
        background: linear-gradient(90deg, #667eea, #764ba2);
        border-color: #667eea;
        z-index: 1;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
        transform: translateY(-1px);
      }
    }
  }
}

:deep(.ant-radio-button-wrapper::before) {
  display: none;
}


.verify-code-btn {
  height: 40px;
  font-size: 14px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border: none;
  color: white;
  border-radius: 6px;
  transition: all 0.3s ease;

  &:hover:not(:disabled) {
    background: linear-gradient(90deg, #764ba2, #667eea);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
  }

  &:disabled {
    background: #f0f0f0;
    color: rgba(0, 0, 0, 0.25);
    border: 1px solid #d9d9d9;
  }
}
</style>